//
//  SGInfomationPhotoAndTextCell.m
//  MomHelp
//
//  Created by xuguoyong on 16/8/19.
//  Copyright © 2016年 hudongkeji. All rights reserved.
//  这个cell是用来显示资讯首页的图片和文字的显示

#import "SGInfomationPhotoAndTextCell.h"

@interface SGInfomationPhotoAndTextCell ()
{
    //资讯图片
    UIImageView *_infomationPic;
    //资讯标题
    XGYLabel *_infomationTitleLabel;
    //资讯传递
    XGYLabel *_infomationTransmitLabel;
    
}

@end
@implementation SGInfomationPhotoAndTextCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self setupImageView];
    }
    return self;
}
- (void)setupImageView
{
    _infomationPic = [[UIImageView alloc] init];
    [self.contentView addSubview:_infomationPic];
   
    _infomationPic.sd_cornerRadius = @3.0f;
    _infomationPic.image = [UIImage imageNamed:@"1245101.jpg"];
   
    
    _infomationTitleLabel  = [[XGYLabel alloc]init];
    _infomationTitleLabel.textColor = textColor333333;
    _infomationTitleLabel.text = @"更年期的女性不需要避孕？";
     _infomationTitleLabel.font = textFont38;
    _infomationTitleLabel.numberOfLines = 0;
    
    [self.contentView addSubview:_infomationTitleLabel];
    
    _infomationTransmitLabel  = [[XGYLabel alloc]init];
    _infomationTransmitLabel.textColor = textColor666666;
    _infomationTransmitLabel.text = @"10位妈妈传递爱心";
    _infomationTransmitLabel.font = textFont24;
    [self.contentView addSubview:_infomationTransmitLabel];
 
    [self setupFrame];
    
}

- (void)setupFrame
{
     _infomationPic.sd_layout.topSpaceToView(self.contentView,15).leftEqualToView(self.contentView).offset(15).bottomSpaceToView(self.contentView,15).widthIs(100 * (284.0f/198.0f));
    
    _infomationTransmitLabel.sd_layout.rightSpaceToView(self.contentView,15).bottomEqualToView(_infomationPic).offset(-1).heightIs(20);
    [_infomationTransmitLabel setSingleLineAutoResizeWithMaxWidth:150];
    
    _infomationTitleLabel.sd_layout.leftSpaceToView(_infomationPic,15).rightSpaceToView(self.contentView,37).topEqualToView(_infomationPic).offset(5).bottomSpaceToView(_infomationTransmitLabel,10);
    [self setNeedsLayout];
}

@end
